Django Standalone Apps by Ben Lopatin

Django Standalone Apps by Ben Lopatin

Author:Ben Lopatin
Language: eng
Format: epub
ISBN: 9781484256329
Publisher: Apress


from django.conf import settings

from django.core.exceptions import ImproperlyConfigured

from myapp.client import ApiClient

if not getattr(settings, "MYAPP_API_KEY"):

raise ImproperlyConfigured("MYAPP_API_KEY must be set")

try:

USE_CACHING = settings.MYAPP_CACHE_SETTINGS["USE_CACHING"]

except (AttributeError, KeyError):

USE_CACHING = False

try:

CACHE_PREFIX = settings.MYAPP_CACHE_SETTINGS["CACHE_PREFIX"]

except (AttributeError, KeyError):

USE_CACHING = "myappp"

try:

CACHE_TTL = int(settings.MYAPP_CACHE_SETTINGS["CACHE_TTL"])

except (AttributeError, KeyError):

CACHE_TTL = 3600

except (TypeError, ValueError):

raise ImproperlyConfigured("MYAPP cache TTL must be a number")



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.